package com.atguigu.spzx.user.controller;

import com.atguigu.spzx.model.entity.user.UserRegion;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.user.service.RegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "省市区数据模块")
@RestController
@RequestMapping("/api/user/region")
public class UserRegionController {
    @Resource
    RegionService regionService;
    @Operation(summary = "查询省市区接口")
    @GetMapping("/findByParentCode/{parentCode}")
    public Result findByParentCode(@PathVariable("parentCode")Long parentCode){
        List<UserRegion> userRegionList = regionService.findByParentCode(parentCode);
        return Result.ok().data(userRegionList);
    }
}
